﻿package mortal.game.view.copy.uniqueBoss.renderer
{
    import Message.Client.*;
    import Message.Public.*;
    import com.gengine.utils.*;
    import com.mui.controls.*;
    import fl.controls.listClasses.*;
    import flash.events.*;
    import mortal.common.global.*;
    import mortal.component.gconst.*;
    import mortal.game.cache.*;
    import mortal.game.manager.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;

    public class UniqueBossDamageRankCellRender extends GCellRenderer
    {
        private var _rank:GTextFiled;
        private var _roleName:GTextFiled;
        private var _damageValue:GTextFiled;
        private var _rankInfo:UniqueBossHurtPlayer;

        public function UniqueBossDamageRankCellRender()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this.pushUIToDisposeVec(UIFactory.gImageBitmap(ImagesConst.SixBossRoleInfoBg, 0, 0, this));
            this._rank = UIFactory.gTextField("", 26 - 3 - 6, 7 - 6, 18, 20, this);
            this._roleName = UIFactory.gTextField("", 79 - 4, 7 - 6, 100, 20, this, GlobalStyle.textFormatBai.center());
            this._roleName.configEventListener(TextEvent.LINK, this.onLinkClickHanlder);
            this._roleName.configEventListener(MouseEvent.MOUSE_OVER, this.onOverHandler);
            this._roleName.configEventListener(MouseEvent.MOUSE_OUT, this.onOutHandler);
            this._damageValue = UIFactory.gTextField("", 210 - 3 - 6 - 45, 7 - 6, 100, 20, this, GlobalStyle.textFormatHuang.right());
            return;
        }// end function

        override public function set listData(param1:ListData) : void
        {
            super.listData = param1;
            if (this._rankInfo)
            {
                this._rank.text = String((this._listData.index + 1));
            }
            return;
        }// end function

        override public function set data(param1:Object) : void
        {
            super.data = param1;
            if (param1 is UniqueBossHurtPlayer)
            {
                this._rankInfo = param1 as UniqueBossHurtPlayer;
                this._roleName.htmlText = HTMLUtil.addLink(this._rankInfo.playerName, GlobalStyle.colorHuang);
                this._damageValue.text = "" + this._rankInfo.hurt;
                if (this._rankInfo.playerId == Cache.instance.role.entityInfo.entityId.id)
                {
                    this.filters = [FilterConst.gradientGlowFilter];
                }
            }
            else
            {
                this._roleName.text = "";
                this._damageValue.text = "";
            }
            return;
        }// end function

        private function onLinkClickHanlder(event:TextEvent) : void
        {
            var _loc_2:int = 0;
            var _loc_3:SEntityId = null;
            if (this._rankInfo)
            {
                _loc_2 = ELookUpType._ELookUpTypePlayer;
                _loc_3 = Cache.instance.role.entityInfo.entityId;
                _loc_3.id = this._rankInfo.playerId;
                GameProxy.chat.lookupRequest(ELookRoleInfoType._ECommonRoleInfo, _loc_3, _loc_2);
            }
            return;
        }// end function

        private function onOverHandler(event:MouseEvent) : void
        {
            CursorManager.showCursor(CursorManager.BUTTON);
            return;
        }// end function

        private function onOutHandler(event:MouseEvent) : void
        {
            CursorManager.hideFromButton();
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl();
            this._rank.dispose();
            this._rank = null;
            this._roleName.dispose();
            this._roleName = null;
            this._damageValue.dispose();
            this._damageValue = null;
            return;
        }// end function

    }
}
